<template>
  <div class="app-container">
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-input
          v-model="query.userId"
          clearable
          size="small"
          placeholder="请输入用户ID"
          style="width: 200px;"
          class="filter-item"
        />
        <el-input
          v-model="query.phone"
          clearable
          size="small"
          placeholder="请输入手机号"
          style="width: 200px;"
          class="filter-item"
        />
        <date-range-picker v-model="query.transactionTime" class="date-item" />
        <el-input
          v-model="query.projectName"
          clearable
          size="small"
          placeholder="请输入项目"
          style="width: 200px;"
          class="filter-item"
        />
        <rrOperation />
      </div>
    </div>
    <div class="tableUp">
      <div class="btnContain">
        <el-button @click="crud.doExport">下载</el-button>
      </div>
    </div>
    <el-table ref="table" v-loading="crud.loading" :height="height" border :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <!-- <el-table-column type="selection" width="50" /> -->
      <el-table-column :show-overflow-tooltip="true" prop="userId" label="用户ID">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.id: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="phone" label="手机号">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.phone: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="username" label="用户名">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.username: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="邀请人">
        <template slot-scope="scope">
          {{ scope.row.userInvitation?scope.row.userInvitation.invitationCode: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="projectName" label="项目" />
      <el-table-column :show-overflow-tooltip="true" prop="confirmedSettlementAmount" label="已确认收益" />
      <el-table-column :show-overflow-tooltip="true" prop="transactionTime" label="时间" />
    </el-table>
    <pagination />
  </div>
</template>

<script>
// import crudFlow from '@/api/pay/flow'
import crudTran from '@/api/pay/tran'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
export default {
  name: 'MoneyFlow',
  components: { rrOperation, pagination, DateRangePicker },
  cruds() {
    return CRUD({ title: '用户流水', url: 'api/transaction', crudMethod: { ...crudTran }})
  },
  mixins: [presenter(), header(), crud()],
  // 数据字典
  data() {
    return {
      height: document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  created() {
  },
  mounted: function() {
    const that = this
    window.onresize = function temp() {
      that.height = document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  methods: {
  }
}
</script>

      <style rel="stylesheet/scss" lang="scss" scoped>
        .tableUp {
          display: flex;
          margin-bottom: 10px;
          justify-content: space-between;
          .btnContain {
            ::v-deep .el-button {
            background-color: rgba(236, 91, 91, 1);
            color: #fff;
            border: 0;
          }
          }
        }

      </style>

